package kata09.customer;

import kata09.info.Goods;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

//单个商品购买类
@NoArgsConstructor
@Data
public class BuyGoods {
    private Goods goods;
    private Integer buyNumber;

    public BuyGoods(Goods goods,Integer buyNumber){
        this.goods = goods;
        this.buyNumber = buyNumber;
    }

    public BigDecimal getGoodsCountDiscountPrice(){
        return goods.getGoodsDiscount().getGoodsDiscountStrategy()
                .getGoodsDiscountPrice(this.buyNumber, goods.getGoods().getPrice());
    }

    public BigDecimal getGoodsCountPrice(){
        return this.getGoods().getGoods().getPrice().multiply(new BigDecimal(this.buyNumber));
    }

}
